***CONTRACEPTIVE CONCORDANCE
***REPLICATION DO FILE
***Sarah Vincent, Catalina Herrera-Almanza, S Anukriti, Mahesh Karra
***Date: 2025-05-20

**# STEP 0: SETTING WORKING DIRECTORY
***To use the correct file directory, replace lines 11-13 below to your specific working directory where your files are stored.

version 13

if "`c(username)'"=="mvkarra" {
                global maindir1 "C:\Users\mvkarra\Dropbox\CONTRACEPTIVE CONCORDANCE PAPER" //Directory for where the pooled NFHS data is stored
				global maindir2 "C:\Users\mvkarra\Dropbox\CONTRACEPTIVE CONCORDANCE PAPER\RESULTS" //Directory for where results will be stored
}
else if "`c(username)'"=="XXX" {
                global maindir1 "XXX"
				global maindir2 "XXX"
}

********************************************************************************
**# OPEN DATASET
use "$maindir1\Replication_Data.dta", clear

**# CHANGE DIRECTORY TO RESULTS
cd "$maindir2"

**# INSTALL ESTPOST AND ESTTAB COMMANDS (IF NOT ALREADY INSTALLED)
capture ssc install estout, replace

*******************************************************
***TABLES
******************************************************
*************
**TABLE 1
*************
* Descriptives
** Panel A
estpost sum current_fp mod_method age_w education_year_w total_children_alive want_less_2y religion_hindu poor employed_w 
esttab using Table_1A.rtf, cells("count(fmt(0)) mean(fmt(3))") label nomtitle nonumber replace

* Caste
estpost tab caste
esttab using Table_1A_caste.rtf, cells("b(fmt(0)) pct(fmt(3))") label nomtitle nonumber replace

**Panel B
estpost sum current_fp mod_method trad_method
esttab using Table_1B.rtf, cells("count(fmt(0)) mean(fmt(3))") label nomtitle nonumber replace

**Panel C
estpost sum wants_fp want_start_fp want_stop_fp want_switch_fp  uncertain_start uncertain_stop uncertain_switch
esttab using Table_1C.rtf, cells("count(fmt(0)) mean(fmt(3))") label nomtitle nonumber replace

** Panel D
estpost sum concordance_fp concordance_switch unwanted_nonuse unwanted_use
esttab using Table_1D.rtf, cells("count(fmt(0)) mean(fmt(3))") label nomtitle nonumber replace



*************
**TABLE 2
*************
***********************Method Mix Traditional and Modern************************

*Method Mix among Want to Switch
estpost tabulate method_classification if want_switch_fp==1
esttab using Table_2A.rtf, cells("b(fmt(0)) pct(fmt(1))") varlabels(`e(labels)') nonumber unstack nomtitle label replace

*Methods Mix among concordance
estpost tabulate method_classification if concordance_fp==1
esttab using Table_2B.rtf, cells("b(fmt(0)) pct(fmt(1))") varlabels(`e(labels)') nonumber unstack nomtitle label replace

*Methods Mix among Unwanted use
estpost tabulate method_classification if unwanted_use==1
esttab using Table_2C.rtf, cells("b(fmt(0)) pct(fmt(1))") varlabels(`e(labels)') nonumber unstack nomtitle label replace

*************
**TABLE 3
*************
***Note: When no women answered "cannot get pregnant" in one group, the option is missing from tables
 
*Do wanted use+switch women want more children?
estpost tabulate w3_w06_w3_604 if wanted_use_switch==1
esttab using Table_3A.rtf, cells("b(fmt(0)) pct(fmt(1))") varlabels(`e(labels)') nonumber unstack nomtitle label replace

*Do wanted non-use women want more children?
estpost tabulate w3_w06_w3_604 if wanted_nonuse==1
esttab using Table_3B.rtf, cells("b(fmt(0)) pct(fmt(1))") varlabels(`e(labels)') nonumber unstack nomtitle label replace

*Do women with unwanted Use want more children?
estpost tabulate w3_w06_w3_604 if unwanted_use==1
esttab using Table_3C.rtf, cells("b(fmt(0)) pct(fmt(1))") varlabels(`e(labels)') nonumber unstack nomtitle label replace

*Do Unwanted non-use women want more children?
estpost tabulate w3_w06_w3_604 if unwanted_nonuse==1
esttab using Table_3D.rtf, cells("b(fmt(0)) pct(fmt(1))") varlabels(`e(labels)') nonumber unstack nomtitle label replace


*************
**FIGURE 4
*************
estpost tabulate wanted_nonuse 
eststo tab1

estpost tabulate wanted_use_switch 
eststo tab2

estpost tabulate unwanted_nonuse 
eststo tab3

estpost tabulate unwanted_use 
eststo tab4

esttab tab1 tab2 tab3 tab4  using "Figure_4.rtf", cells("b(fmt(0)) pct(fmt(1))") nomtitle nonumber replace

*** Modern vs Traditional
*Methods Mix among concordance
***  
*************
**FIGURE 5
*************
*** New Measure Tabulations 
estpost tabulate wanted_nonuse 
eststo tab1

estpost tabulate wanted_use_switch 
eststo tab2

estpost tabulate unwanted_nonuse 
eststo tab3

estpost tabulate unwanted_use 
eststo tab4
*** Standard Measure Tabulations 
estpost tab met_need_original
eststo tab5

estpost tab unmet_unneed_original
eststo tab6

estpost tab unmet_need_original 
eststo tab7

estpost tab met_unneed_original
eststo tab8

esttab tab1 tab2 tab3 tab4 tab5 tab6 tab7 tab8 using "Figure_5.rtf", cells("b(fmt(0)) pct(fmt(1))") nomtitle nonumber replace

*************
**FIGURE 6
*************
estpost tabulate want_need 
eststo tab1

estpost tabulate unwant_unneed
eststo tab2

estpost tabulate want_unneed 
eststo tab3

estpost tabulate unwant_need
eststo tab4


esttab tab1 tab2 tab3 tab4 using "Figure_6.rtf", cells("b(fmt(0)) pct(fmt(1))") nomtitle nonumber replace

*************
**TABLE 7
*************
**************** Kappa statistics between the two methods***********************

kap wanted_nonuse met_unneed_original
kap unwanted_nonuse unmet_need_original
kap unwanted_use unmet_unneed_original
kap wanted_use_switch met_need_original
